package com.daohang.generator.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import com.daohang.dh.entity.MidpCusProjRelationEntity;
import com.daohang.dh.manager.MidpCusProjRelationManager;
import com.daohang.dh.service.MidpCusProjRelationService;

/**
 * 客户项目关系表
 *
 * @author xiaomei
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018/05/23
 */
@Service("midpCusProjRelationService")
public class MidpCusProjRelationServiceImpl implements MidpCusProjRelationService {

	@Autowired
	private MidpCusProjRelationManager midpCusProjRelationManager;

	@Override
	public Page<MidpCusProjRelationEntity> listMidpCusProjRelation(Map<String, Object> params) {
		Query query = new Query(params);
		Page<MidpCusProjRelationEntity> page = new Page<>(query);
		midpCusProjRelationManager.listMidpCusProjRelation(page, query);
		return page;
	}

	@Override
	public R saveMidpCusProjRelation(MidpCusProjRelationEntity role) {
		int count = midpCusProjRelationManager.saveMidpCusProjRelation(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getMidpCusProjRelationById(Long id) {
		MidpCusProjRelationEntity midpCusProjRelation = midpCusProjRelationManager.getMidpCusProjRelationById(id);
		return CommonUtils.msg(midpCusProjRelation);
	}

	@Override
	public R updateMidpCusProjRelation(MidpCusProjRelationEntity midpCusProjRelation) {
		int count = midpCusProjRelationManager.updateMidpCusProjRelation(midpCusProjRelation);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = midpCusProjRelationManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
